1. Field of the Invention
Aspects of the present invention are directed to defining model characters of a font, and more particularly, to a system and method for automatically defining model characters of a font that may be used, for example, in optical character recognition.
2. Discussion of the Related Art
Font-based Optical Character Recognition (OCR) systems perform OCR on an image with respect to a specific font.
A font is composed of a set of characters (e.g., ASCII values) and a corresponding set of model characters. A model character is a representation of the corresponding character, such as a grayscale or binary image of the character, that may be used during a subsequent recognition process. Rather than an image of the character, a model character may alternatively be defined as a set of features extracted from an image of the character, or a mathematical description of the character. During the subsequent character recognition process, an unknown character in an image is compared with each of the model characters of the selected font, and the character corresponding to the best match is returned.
In many instances, model characters may be generated based upon a font to which a user has access. For example, certain conventional systems permit the user to define a font for OCR directly from a “system font.” The user simply provides (1) a reference to a font defined on his/her operating system (e.g., a TrueType, PostScript, or Bitmap font), (2) the set of characters for which model characters are to be defined, and (3) the desired point size of the model characters. A model character may then be automatically generated for each of the requested characters from the corresponding system font character.
However, in certain instances, users may not have access to a “system font” for the font they want to read via OCR. For example, a user may wish to utilize OCR to recognize vehicle license plate numbers, or perhaps, to recognize the serial numbers, etc. on parts in an automated manufacturing environment. In such applications, the fonts that were used to form the characters may not be readily or conveniently available, or may be specific to specific governments or part manufacturers. In such instances, the user must resort to defining the fonts “manually.”
In certain OCR systems, a user may manually define a font by providing a sample image (grayscale or binary) of each character of the font. The user may either provide an image of the character (exclusively) or may provide a more complex image containing a character (potentially in combination with other characters or image data) and a region of interest (ROI) outlining the bounding box of the character. It should be appreciated that defining a region of interest (ROI) in an image is impractical, unless a Graphical User Interface is available offering such functionality.
It should be appreciated that model definition is a critical step of the OCR process: if model characters are poorly defined, the performance of the OCR system will suffer. Accordingly, the user must define each model character with care.
Defining each model character one at a time is very time-consuming and tedious, particularly when the font contains a large set of characters: uppercase and lowercase characters, numerals, marked characters (containing dots, accents, etc.), punctuation, etc.
To accelerate the model definition process, schemes have been proposed that define several model characters at once. For example, a prior OCR module provided the following method of font definition described with respect to FIGS. 1-3B. As illustrated in FIG. 1, the method receives for input (1) a string of characters 110 (e.g., an ASCII string) typically provided by the user and denoted “User String” in FIG. 1, (2) an image 120 containing an occurrence of the string in its top-left corner, and (3) the width w and height h of a rectangle 130 (e.g., bounding box) bounding a character, which was assumed to be the same for each character of the string. As illustrated in FIGS. 2A and 2B, the method defines a model character 210 for the ith character of the string as the portion of the image bounded by the rectangle having corners:[(i−1)w,0][iw,0][(i−1)w,h][iw,h]
This method assumes that all characters have equal width, which is not the case for all fonts. For example, in proportional-width fonts, such as illustrated in FIG. 3A, different characters (for example, uppercase “I”) have different widths than other characters (for example, uppercase “M”). FIG. 3B illustrates what happens when the method described above is applied to a proportional font.